<?php
 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Content extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        //$this->checkAdmin($this->session->userdata('admin_id'));
        $this->data['controller'] = 'content';         
        $this->load->model('Mcontent');
    }
    
    public function search()
    {
        $keyword = $this->getParamString("keyword");
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        die(json_encode($this->Mcontent->Search($keyword,$limit,$stt)));
    }
    
    public function getnewincentive()
    {
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        die(json_encode($this->Mcontent->getNewIncentive($limit,$stt)));
    }
    
    public function getincentivefixed()
    {
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        die(json_encode($this->Mcontent->getIncentiveFixed($limit,$stt)));
    }
    
    public function getincentivemonthly()
    {
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        die(json_encode($this->Mcontent->getIncentiveMonthly($limit,$stt)));
    }
    
    public function getrestaurantmenus()
    {
        $id = $this->getParamInt("id");
        die(json_encode($this->Mcontent->getRestaurantMenus($id)));
    }
    
    public function getreviewrestaurant(){
        $id = $this->getParamInt("id");
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        die(json_encode($this->Mcontent->getReviewRestaurant($id,$limit,$stt)));
    }
    	
	
    
    public function submitreviewrestaurant(){
        $restaurant_id = $this->getParamInt("restaurant_id");
        $user_id = $this->getParamInt("user_id");
        $name = $this->getParamString("name");
        $star = $this->getParamInt("star");
        $content = $this->getParamString("content");
        die(json_encode($this->Mcontent->submitReviewRestaurant($restaurant_id,$user_id,$name,$star,$content)));
    }
    
	public function getreviewcoupon(){
		$id = $this->getParamInt("id");
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        die(json_encode($this->Mcontent->getReviewCoupon($id,$limit,$stt)));
	}
	
	
	public function submitreviewcoupon(){
        $coupon_id = $this->getParamInt("coupon_id");
        $user_id = $this->getParamInt("user_id");
        $name = $this->getParamString("name");
        $star = $this->getParamInt("star");
        $content = $this->getParamString("content");
        die(json_encode($this->Mcontent->submitReviewCoupon($coupon_id,$user_id,$name,$star,$content)));
    }
	
	public function submitbooking(){
		$user_id = $this->getParamInt('user_id');
		$name = $this->getParamString("name");
		$phone = $this->getParamString("phone");
        $email = $this->getParamString("email");
        $dates = $this->getParamString("dates");
        $time = $this->getParamString("time");
		$restaurant_id = $this->getParamInt('restaurant_id');
		$address_id = $this->getParamInt('address_id');
		$peoples = $this->getParamInt('peoples');
		$is_gpeople = $this->getParamInt('is_gpeople');
        $required = $this->getParamString("required");
        die(json_encode($this->Mcontent->submitBooking($user_id,$name,$phone,$email,$dates,$time,$restaurant_id,$address_id,$peoples,$is_gpeople,$required)));
	}
	

	public function getincentivelabel(){
        $limit = $this->getParamInt("limit");
        $stt = $this->getParamInt("stt");
        $label = $this->getParamInt("label");
        die(json_encode($this->Mcontent->getIncentiveLabel($limit,$stt,$label)));
    }
}
